package com.zhida.jiyangcenter.order

import android.os.Bundle
import chooongg.base.annotation.ContentLayout
import chooongg.base.annotation.TitleBar
import chooongg.base.utils.startActivity
import com.zhida.jiyangcenter.R
import com.zhida.jiyangcenter.mian.BaseActivity
import kotlinx.android.synthetic.main.activity_pay_success.*

@TitleBar(false)
@ContentLayout(R.layout.activity_pay_success)
class PaySuccessActivity : BaseActivity() {
    override fun initConfig(savedInstanceState: Bundle?) {
        title_bar.navigationIcon(R.drawable.iv_back_fill) {
            finish()
        }.title("支付成功")
        tv_pay_money.text = "￥${intent.getDoubleExtra("PayMoney", 0.00)}"
        when (intent.getIntExtra("PayType", -1)) {
            0 -> {
                tv_pay_type.text = "钱包支付"
                iv_pay_type.setImageResource(R.drawable.iv_pay_qianbao)
            }
            1 -> {
                tv_pay_type.text = "微信支付"
                iv_pay_type.setImageResource(R.drawable.iv_pay_wechat)
            }
            2 -> {
                tv_pay_type.text = "支付宝支付"
                iv_pay_type.setImageResource(R.drawable.iv_pay_alipay)
            }
        }
        tv_pay_order.setOnClickListener {
            if (intent.getStringExtra("PayOrderType") == "0") {
                startActivity<ShopOrderActivity> {
                    putExtra("uuid", intent.getStringExtra("PayOrderUuid"))
                }
            } else {
                startActivity<ServeOrderDetailsActivity> {
                    putExtra("order_code", intent.getStringExtra("PayOrderUuid"))
                }
            }
        }
    }
}